
import pygame
import ctypes

# import window specific access to dll
windll = ctypes.windll
#_gdi32 = windll.gdi32
#_kernel32 = windll.kernel32
_user32 = windll.user32

# constants (copied from pyglet.window.win32.constants.py)
SW_HIDE = 0
SW_SHOWNORMAL = 1
SW_NORMAL = 1
SW_SHOWMINIMIZED = 2
SW_SHOWMAXIMIZED = 3
SW_MAXIMIZE = 3
SW_SHOWNOACTIVATE = 4
SW_SHOW = 5
SW_MINIMIZE = 6
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_RESTORE = 9
SW_SHOWDEFAULT = 10
SW_FORCEMINIMIZE = 11
SW_MAX = 11


# main
def minimize():
    pygame.init()
    
    info = pygame.display.get_wm_info()
    
    # get the hwnd
    hwnd = info['window']
    
    _user32.ShowWindow(hwnd, SW_MINIMIZE)